package com.ddwl.order.dao;

import com.ddwl.common.dao.TkDao;
import com.ddwl.order.dao.mapper.OrderSpuMapper;
import com.ddwl.order.dao.model.OrderInfo;
import com.ddwl.order.dao.model.OrderSpu;
import com.ddwl.schema.bo.order.QueryOrderListBo;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * 订单商品表(OrderSpu)表数据库访问层
 *
 * @author makejava
 * @since 2020-06-02 14:48:17
 */
@Repository

public class OrderSpuDao extends TkDao<OrderSpuMapper, OrderSpu> {


    /**
     * 订单查询售后中的商品
     * @return
     */
    public List<OrderSpu> getOrderAfterSaleSpu(String orderId){
        Example example = getExample();
        example.and().andEqualTo("orderId",orderId)
                .andNotEqualTo("isAfterSale", 0);
        return baseMapper.selectByExample(example);
    }

    public List<OrderSpu> getOrderSpu(OrderInfo spu) {
        return baseMapper.getOrderSpu(spu);
    }

    public List<OrderSpu> getSpuOrderList(QueryOrderListBo bo) {
        return baseMapper.getSpuOrderList(bo);
    }
}

